<template>
  <div>
    <el-button @click="MessageCenterGetList('入库申请')">入库申请</el-button>
    <el-button @click="MessageCenterGetList('出库审核')">出库审核</el-button>
    <el-button @click="MessageCenterGetList('报损消息')">报损消息</el-button>
    <el-button @click="MessageCenterGetList('调拨消息')">调拨消息</el-button>
    <el-button @click="MessageCenterGetList('库存预警')">库存预警</el-button>
    <el-button @click="MessageCenterGetList('采购信息')">采购信息</el-button>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="msgTitle" label="标题">
        <template slot-scope="scope">
        <el-button type="text" @click="TZ(scope.row.id)">{{scope.row.msgTitle}}</el-button>
      </template>
      </el-table-column>
      <el-table-column prop="msgTime" label="接受时间"> </el-table-column>
      <el-table-column prop="msgType" label="消息类型"> </el-table-column>
      <el-table-column prop="msgState" label="消息状态"> </el-table-column>
    </el-table>
    <div>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageIndex"
        :page-sizes="[5, 10, 15, 20]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="totalCount"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { MessageCenterGetList } from "@/api/systemSet/MessageCenter";
export default {
  data() {
    return {
      tableData: [],
      pageIndex: 1,
      pageSize: 5,
      totalCount: 0,
      pageCount: 0,
      msgType: "" || null,
    };
  },
  created() {
    //消息中心列表
    this.MessageCenterGetList();
  },
  methods: {
    //消息中心列表
    MessageCenterGetList(val) {
      // console.log(val);
      var params = {
        pageIndex: this.pageIndex,
        pageSize: this.pageSize,
        msgType: val,
      };
      MessageCenterGetList(params).then((res) => {
        console.log(1111111111111, res.data);
        this.tableData = res.data.data.result;
        this.totalCount = res.data.data.totalCount;
        this.pageCount = res.data.data.pageCount;
      });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pageSize = val;
      this.MessageCenterGetList();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.pageIndex = val;
      this.MessageCenterGetList();
    },
    TZ(id) {
    //   alert(1);
      //跳转页面
      this.$router.push("/SystemSet/MessageCenter/MessageCenterdetail?id="+id)
    },
  },
};
</script>

<style>
</style>